﻿using System.Collections.Generic;

namespace RG.Common
{
    public static class FileNameCorrector
    {
        public static string FixFileName(this object obj)
        {
            var ret = obj.ToString();
            if (string.IsNullOrEmpty(ret)) return "some_filename";
            var badSimbols = new List<string> {"/", @"\", ":", "*", "?", "\"", "<", ">", "|"};
            foreach (var sb in badSimbols)
            {
                ret = ret.Replace(sb, "_");
            }
            return ret;
        }

    }
}
